I apologize if this issue is trivial, but I have only been programming with DXL for about a month or so. I am trying to get a particular object from a Skip List based on an absolute number (which is the key). I have determined, using the find function, that the absolute number exists in the Skip List. Now, I want to save that object in a local variable to compare its attributes with another object. In my main function, I have 2 calls to a function called storeAllObjects which puts the objects of 2 baselines in their own Skip List. I then have a for loop which goes thru each item in one Skip List, gets the absolute number of the item, then searches for it in the 2nd Skip List. If it's found in the 2nd list, I just want to save that object to a temporary variable to allow me to compare the attributes of each. Here is the code I have so far:
storeAllObjects(bm1, oldBlObjs); //store baseline1 objects into Skip List
storeAllObjects(bm2, newBlObjs); //store baseline2 objects to 2nd skip list
for oObj in newBlObjs do {
int absNum = oObj."Absolute Number";
//check if this absNum appears in old baseline skip list
bool bFoundInOld = find(oldBlObjs, absNum);
if (bFoundInOld) {
oOldObj = object(absNum, bm2);
for attr in selectedAttributes do {
newObjAttr = oObj.attr "";
oldObjAttr = oOldObj.attr "";
if (newObjAttr != oldObjAttr) {
displayChangedObj(out, oOldObj, oObj, attr);
}
}
} else {
//This is an objects that has been added
...
...
}
}
The problem I'm having is that I get an error when the code tries to get the oOldObj.attr value because the oOldObj, for some reason, is null. I would greatly appreciate any help you can give me.
Chris Christopher Cote - Mon Oct 10 10:06:59 EDT 2016 |
Re: New DXL programmer needs help using Skip Lists The find function of the skip list has a third optional output (reference) parameter, that allows you to retrieve the baseline object from the skip list. That way you do not need to call object(...) and will probably not get the errors anymore, because object relies on the current display set (e.g. for filtered / non visible objects you will get null) bool bFoundInOld = find(oldBlObjs, absNum, oOldObj); Hope this helps, regards, Mathias |